<?php
/**
 * licenses : MIT
 * creatTime: 2020/5/14
 * author : weblinuxgame
 * filename: WebSocketClientController.php
 */

namespace App\Http\Controllers\Web;

use Illuminate\View\View;
use App\Http\Controllers\Controller;

/**
 * client
 * Class WebSocketClientController
 * @package App\Http\Controllers
 */
class WebSocketClientController extends Controller
{
    /**
     * @return View
     */
    public function index()
    {
        return view('ws/client', ['serverUrl' => $this->getServerUrl()]);
    }

    public function getServerUrl(): string
    {
        $domain = env('APP_WS_DOMAIN', 'ws://127.0.0.1');
        $port = config('laravels.listen_port', '8080');
        return $domain . ':' . $port;
    }
}
